import 'package:flutter/cupertino.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';

class ZDialog {
  static void show(
    Widget child, {
    BuildContext? context,
    bool permanent = true,
    bool backDismiss = true,
    SmartAnimationType? animationType,
    String? tag,
    Alignment? alignment,
  }) {
    SmartDialog.show(
      // useSystem: true,
      // keepSingle: true,
      bindWidget: context,
      backDismiss: backDismiss,
      bindPage: true,
      permanent: permanent,
      animationType: animationType,
      alignment: alignment,
      tag: tag ?? "zDialog",
      builder: (_) {
        return child;
      },
    );
  }

  static void hide({
    bool force = true,
    String? tag,
  }) {
    SmartDialog.dismiss(
      tag: tag ?? "zDialog",
      force: force,
    );
  }
}
